<?php

@$id = $_REQUEST["id"];
@$zhuoname = $_REQUEST["zhuoname"];

function update($id, $zhuoname)
{
   

    $pdo = new PDO("mysql:dbname=caipin;host=127.0.0.1;charset=utf8", "root", "root");

    $sql = $pdo->prepare("select * from zhuohao where zhuoid=:id");
    $sql->execute(array("id" => $id));
    $jg = $sql->fetch(PDO::FETCH_NAMED);
    if (!empty($jg)) {
        $usql = $pdo->prepare("update zhuohao set zhuoname=:n where zhuoid=:id;");
        $isok = $usql->execute(array("n" => $zhuoname , "id" => $id));
        if ($isok) {
            echo "修改成功！";
			 header("Refresh:3;url=xiugaicanzhuo.php");
        } else {
            echo "修改失败！";
        }
    }

}

if (!empty($id)) {

    update($id, $zhuoname);
}
